<template>
	<view class="container">
		<!-- LOGO -->
		<view class="header">
			<view class="time" @click="addEmployee">
				+
			</view>

			<view class="table">
				<view style="margin: 15px 15px 5px 15px;font-weight: 600;font-size: 15px;color: #25406e">
					<text>白名单列表</text>
				</view>
				<view style="padding: 0px 40px;margin-top: 25px;">
					<view v-for="(item, index) in array" :key="item.id">
						<view style="display: flex;justify-content: space-between;">
							<view style="color: #aaaaaa;font-size: 15px;">{{item.faceName}}</view>
							<view style="color: #1b3767;font-size: 15px;" @click="deletebutton(item)">删除</view>
						</view>
						<view style="width: 100%;height: 1px; background: #dcdde4;margin: 10px 0px;"></view>
					</view>
				</view>
			</view>
		</view>
		<tabBar></tabBar>
	</view>
</template>

<script>
	import {
		findShopFace,
		deleteShopFace
	} from '@/network/humanFace.js';
	export default {
		data() {
			return {
				current: {
					organId: uni.getStorageSync('organId'),
					nameType: "1"
				},
				array: [],

			}
		},
		mounted() {
			this.getServerData()
		},
		methods: {
			getServerData() {
				findShopFace(this.current).then(res => {
					const code = res.data.code;
					if (code === 200) {
						this.array = res.data.result
					}
				})
			},
			addEmployee() {
				wx.navigateTo({
					url: '/pages/humanFace/addWhitelist'
				})
			},
			deletebutton(item) {
				deleteShopFace(item).then(res => {
					if (res.data.code === 200) {
						this.getServerData()
						uni.showToast({
							title: '删除成功',
							icon: 'success',
							duration: 2000
						})

					}
				});
			}
		}
	}
</script>

<style>
	.container {
		height: 100vh;
		display: flex;
		flex-direction: column;
		background: #f0f2fa;
	}

	.header {
		height: 100vh;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.time {
		width: 90%;
		height: 45px;
		background: #fff;
		margin-top: 3%;
		border-radius: 10px;
		line-height: 45px;
		text-align: center;
		font-size: 30px;
	}

	.table {
		width: 90%;
		height: 100%;
		background: #fff;
		margin-top: 5%;
		border-radius: 10px;

	}
</style>